package com.leo.customer.config

import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
import springfox.documentation.oas.annotations.EnableOpenApi
import springfox.documentation.service.ApiInfo
import springfox.documentation.service.Contact
import springfox.documentation.spi.DocumentationType
import springfox.documentation.spring.web.plugins.Docket

@EnableOpenApi
@Configuration
class SwaggerConfig : WebMvcConfigurer {

    @Bean
    fun docket(): Docket {
        return Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .enable(true)
                .select()
                .build()
    }

    fun apiInfo(): ApiInfo {
        val contact = Contact("名字：卢浩", "", "邮箱：18340082521@qq.com")
        return ApiInfo(
                "工作项目",
                "",
                "版本: v1.0",
                "",
                contact,
                "许可：Apache 2.0 ", // 许可
                "许可链接：XXX", // 许可连接
                mutableListOf()
        )
    }
}
